<include file="Public/_meta" />
<title>查询统计</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 查询统计  <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="text-c">
	    <form action="{:U('Static/index')}"  method="post">
	        <ul class="secrch">
						<li> 贷款总行
						<select name="parent_bank" class="select-box inline select-zong">
							<option value="0">所有银行</option>
							<volist name="parents" id="p">
									<option value="{$p.bank_id}" <if condition="$p['bank_id'] eq $parent">selected</if>>{$p.bank_name}</option>
							</volist>
						</select></li>
						 <li>  贷款支行
						<select name="child_bank" class="select-box inline select-zhi">
							<empty name="child"><option value="">所有支行</option><else /><option value="{$child}" class="">{$child|getBankName}</option></empty>
						</select></li>
                 <li> 送审时间
                    <input class="input-text kk" onClick="laydate()" style=" width:100px" name="send_start" value="{$send_start}">
            		-
            		<input class="input-text kk" onClick="laydate()" style=" width:100px" name="send_end" value="{$send_end}"></li>
                 <li>实际放款时间
                    <input class="input-text kk" onClick="laydate()" style=" width:100px" name="money_start" value="{$money_start}">
            		-
            		<input class="input-text kk" onClick="laydate()" style=" width:100px" name="money_end" value="{$money_end}"></li>
                 <li>营销人<input type="text" name="market"   class="input-text kk" style=" width:120px" value="{$market}"></li>
                 <li>签单人<input type="text" name="sign"  class="input-text kk" style=" width:120px" value="{$sign}"></li>
							 <eq name="user.roleid" value="4">
								 <li>区域
									 <select name="place" class="select-box inline">
			 							<option value="">所有区域</option>
			 							<option value="1" <if condition="$place eq 1">selected</if>>市区</option>
										<option value="2" <if condition="$place eq 2">selected</if>>江宁</option>
										<option value="3" <if condition="$place eq 3">selected</if>>江北</option>
			 						</select>
								 </li>
							 </eq>
							 <eq name="user.roleid" value="4">
								 <li>贷款类型
									 <select name="supervise" class="select-box inline">
										 		<option value="">所有类型</option>
											 <option value="1" <if condition="$supervise eq 1">selected</if>>贷款监管</option>
											 <option value="2" <if condition="$supervise eq 2">selected</if>>全款监管</option>
											 <option value="3" <if condition="$supervise eq 3">selected</if>>不监管</option>
									 </select>
								 </li>
							 </eq>
                 <li><button type="submit" class="btn btn-success radius" ><i class="Hui-iconfont">&#xe665;</i>搜索</button></li>
            </ul>
	    </form>
    </div>
<notempty name="document">
    <div class="dc">
    <div class="dc-left">共<span class="fonnt02">{$docnum}条</span> 商业贷款总金额<span class="fonnt02">{$sumbusy}万元</span> 公积金贷款总金额<span class="fonnt02">{$sumaccount}万元</span></div>
    <div class="dc-right"><a href="" id="daochu" ><button type="button" class="btn btn-success radius" >导出Excel</button></a></div>
    </div>
	<div class="mt-20">
	<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c">
          <th width="20"></th>
					<th width="80">姓名</th>
					<th width="100">监管类型</th>
					<th width="80">贷款银行</th>
          <th width="80">贷款支行</th>
					<th width="80">商业贷款金额(万元)</th>
          <th width="80">贷款总金额(万元)</th>
          <th width="120">营销人</th>
          <th width="120">签单人</th>
          <th width="75">送审时间</th>
          <th width="100">实际放款时间</th>
				</tr>
			</thead>
			<tbody>
				<volist name="document" id="doc">
				<tr class="text-c">
          <td>{$i}</td>
					<td><u style="cursor:pointer" class="text-primary" onClick="article_edit('查看','{:U('Index/mortgagealert',array('doc_id'=>$doc['doc_id']))}')" title="查看">{$doc.buy_name}</u></td>
					<td>{$doc['supervise']=='1'?'贷款监管':($doc['supervise']=='2'?'全款监管':'不监管')}</td>
					<td>{$doc.bank_id|getBankName}</td>
          <td>{$doc.part_bank_id|getBankName}</td>
					<td>{$doc.doc_id|getMoney}</td>
					<td>{$doc.amount}</td>
					<td>{$doc.market_id|getUsername}</td>
          <td>{$doc.sign_id|getUsername}</td>
          <td><if condition="$doc['audit_time'] neq ''">{$doc.audit_time|turnTime}</if></td>
          <td><if condition="$doc['credit_real_time'] neq ''">{$doc.credit_real_time|turnTime}</if></td>
				</tr>
			</volist>
			</tbody>
		</table>
	</div>
	<div class="manu">
	    {$page}
	</div>
</div>
<else />
搜索数据为空
</notempty>

<include file="Public/_footer" />
    <script>
    $('#daochu').click(function(){
      var parent_bank = $("select[name=parent_bank]").val();
      var child_bank = $("select[name=child_bank]").val();
      var send_start = $("input[name=send_start]").val();
      var send_end = $("input[name=send_end]").val();
      var money_start = $("input[name=money_start]").val();
      var money_end = $("input[name=money_end]").val();
      var market = $("input[name=market]").val();
      var sign = $("input[name=sign]").val();
			var place = $("select[name=place]").val();
			var sup = $("select[name=supervise]").val();
      var url = "{:U('Excel/search')}?parentbank="+parent_bank+"&&childbank="+child_bank+"&&sendstart="+send_start+"&&sendend="+send_end+"&&moneystart="+money_start+"&&moneyend="+money_end+"&&market="+market+"&&sign="+sign+"&&place="+place+"&&supervise="+sup
      $(this).attr("href" , url);
})
</script>
<script type="text/javascript">
$('.select-zong').change(function(){
    var len=$('.select-zong option').length;
    for(i = 0;i < len;i++){
        if($('.select-zong option').eq(i).is(':selected')){
            var id=$('.select-zong option').eq(i).val();
        }
    }
    $.ajax({
        type:'post',
        url:"{:U('Static/zhi')}",
        data:{id:id},
        dataType:'json',
        success:function(json){
            // alert(json[0][])
            // alert(JSON.stringify(json))
            console.log(json);
            // alert(json[0]['bank_id']);
            $('.select-zhi').empty();
            $('.select-zhi').append('<option value="">选择银行</option>')
            var len=json.length;
            for(i = 0;i <= len;i++){
                $('.select-zhi').append('<option value='+json[i]['bank_id']+'>'+json[i]['bank_name']+'</option>')
            }
        }
    })
})


$('.table-sort').dataTable({
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
	  {"orderable":false,"aTargets":[0,8]}// 不参与排序的列
	]
});

/*建档-添加*/
function picture_add(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
/*资讯-编辑*/
function article_edit(title,url,id,w,h){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
/*资讯-删除*/
function article_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$(obj).parents("tr").remove();
		layer.msg('已删除!',{icon:1,time:1000});
	});
}

</script>
</body>
</html>
